﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QiAdmin.Core.Models
{
    public class AppData
    {
        public DB DB { get; set; }
        public JwtToken JwtToken { get; set; }
        public GuidToken GuidToken { get; set; }
        public Cache Cache { get; set; }
        public System System { get; set; }
    }

    /// <summary>
    /// 数据库配置
    /// </summary>
    public class DB
    {
        /// <summary>
        /// 数据库类型
        /// </summary>
        public string Type { get; set; }

        /// <summary>
        /// 数据库连接字符串
        /// </summary>
        public string Connection { get; set; }
    }

    /// <summary>
    /// Jwt Token配置
    /// </summary>
    public class JwtToken
    {
        /// <summary>
        /// //密钥
        /// </summary>
        public string Secret { get; set; }
        /// <summary>
        /// 颁发者
        /// </summary>
        public string Issuer { get; set; }
        /// <summary>
        /// 接收者
        /// </summary>
        public string Audience { get; set; }
        /// <summary>
        /// 过期时长(分钟)
        /// </summary>
        public int Expiration { get; set; }
    }

    /// <summary>
    /// GuidToken配置
    /// </summary>
    public class GuidToken
    {
        /// <summary>
        /// 过期时长(分钟)
        /// </summary>
        public int ExpiresTime { get; set; }
    }

    /// <summary>
    /// 系统配置
    /// </summary>
    public class System
    {
        /// <summary>
        /// 接收请求Header中的Token标记
        /// </summary>
        public string TokenTag { get; set; }

        /// <summary>
        /// 是否记录WebApi参数日志
        /// </summary>
        public bool IsWebApiLog { get; set; }

        /// <summary>
        /// 不需要进行签名验证的路由，前后模糊匹配
        /// </summary>
        public string[] IgnoreVerifySignPaths {  get; set; }

        /// <summary>
        /// 不需要进行日志记录的路由，前后模糊匹配
        /// </summary>
        public string[] IgnoreWebApiLogPaths { get; set; }

        /// <summary>
        /// 不需要进行Token验证的路由，前后模糊匹配
        /// </summary>
        public string[] IgnoreVerifyTokenPaths { get; set; }

        /// <summary>
        /// 签名验证私钥
        /// </summary>
        public string SignPrivateKey {  get; set; }

        /// <summary>
        /// 设置允许请求的大小(单位M)
        /// </summary>
        public int MaxRequestSize {  get; set; }

        /// <summary>
        /// //获取真实IP的header标记，X-Real-IP、X-Forwarded-For
        /// </summary>
        public string RealIpTag {  get; set; }
    }

    public class Cache
    {
        /// <summary>
        /// 缓存类型(Memory或者Redis)
        /// </summary>
        public string Type { get; set; }

        /// <summary>
        /// Redis的连接信息
        /// </summary>
        public string RedisConnection { get; set; }
    }

}